home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Audio / PlayMusic.c next >
Encoding:
C/C++ Source or Header  |  1998-10-18  |  1.4 KB  |  59 lines

  1. /* Dice: 1> dcc -l0 -mD dpk.o tags.o PlayMusic.c -o PlayMusic
  2. **
  3. ** This demo plays music modules (protracker/soundtracker format).
  4. ** You can alter the filename to play whatever mod you have on
  5. ** your hard-drive.
  6. */
  7.  
  8. #include <proto/dpkernel.h>
  9. #include <sound/all.h>
  10.  
  11. BYTE *ProgName      = "Play Music";
  12. BYTE *ProgAuthor    = "Paul Manias";
  13. BYTE *ProgDate      = "May 1998";
  14. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  15. BYTE *ProgShort     = "Plays a music module.";
  16.  
  17. struct GScreen *Screen;
  18.  
  19. /*=========================================================================*/
  20.  
  21. void main(void)
  22. {
  23.   struct JoyData *joy;
  24.   struct Music *music;
  25.   struct FileName musicfile = { ID_FILENAME, "HD1:tune2_00.mod" };
  26.   struct Module *MusicModule;
  27.  
  28.   if (Screen = Init(Get(ID_SCREEN),NULL)) {
  29.  
  30.      if (joy = Init(Get(ID_JOYDATA),NULL)) {
  31.  
  32.         if (MusicModule = OpenModule(NULL, "music.mod")) {
  33.  
  34.            if (music = Get(ID_MUSIC)) {
  35.  
  36.               music->Source = &musicfile;
  37.  
  38.               if (Init(music,NULL)) {
  39.  
  40.                  Show(Screen);
  41.  
  42.                  Activate(music);
  43.  
  44.                  do {
  45.                    Query(joy);
  46.                    WaitAVBL();
  47.                  } while (!(joy->Buttons & JD_LMB));
  48.               }
  49.            Free(music);
  50.            }
  51.         Free(MusicModule);
  52.         }
  53.      Free(joy);
  54.      }
  55.   Free(Screen);
  56.   }
  57. }
  58.  
  59.